#include "ball.h"

Ball::Ball(int ID, vec2 location, vec2 velocity) {
	id = ID;
	loc = location;
	speed = velocity;
}

vec2 Ball::getLocation() {
	return loc;
}

vec2 Ball::getSpeed() {
	return speed;
}

double Ball::getID() {
	return id;
}

double Ball::velocity() {
	return abs(sqrt(pow(speed[0],2) + pow(speed[1],2)));
}

void Ball::changeLocation(double x, double y) {
	loc = vec2(x,y);
}

void Ball::changeVelocity(double Vx, double Vy) {
	speed = vec2(Vx,Vy);
}

void Ball::draw(double radius) {
	double x = getLocation()[0];
	double y = getLocation()[1];
	glPushMatrix();
	glTranslated(0,-0.1,0);
	glRotated(-90,1,0,0);
	glTranslated(x, y, radius);
	glutSolidSphere(radius,50,50);
	glPopMatrix();
}